<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../plugins/layui/css/layui.css" />
		<link href="../../kitAdmin/css/app.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" type="text/css" href="../../plugins/select2/dist/css/select2.min.css"/>
		<link rel="stylesheet" type="text/css" href="../../plugins/bootstrap/css/bootstrap.css"/>
		<link rel='stylesheet' href='../../plugins/bootstrap-table/bootstrap-table.css' />
	</head>

	<body>
		<div class='kit-table'>
			<div style='margin:10px'>
				
		<form class='layui-form' action='' lay-filter='form-edit'>
			<input type='hidden' name='uniqueId'  data-link='{:uniqueId}' />
			<table id='_table'></table>
		</form>
			</div>
		</div>
		<script src="../../common/js/jquery.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../static/js/base.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../plugins/jsviews/jsviews.js" type="text/javascript"></script>
		<script src="../../plugins/bootstrap/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
		<script src='../../plugins/bootstrap-table/bootstrap-table.js' type='text/javascript'></script>
		<script src="../../plugins/select2/dist/js/select2.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var uid = getQueryVariable('uniqueId');
			var submissionTime = getQueryVariable('submissionTime');
			var teacherId = getQueryVariable('teacherId');
			jQuery(document).ready(function() {
				bindFormData();
				//------------------------------------------加载列表
				var col = [ 
				{
					title:'Leave Date',
					field:'classDateStr',
					align: 'center',
					valign: 'middle'
				},
				{
					title:'Leave Time',
					field:'classPeriod',
					align: 'center',
					valign: 'middle'
				},
				{
					title:'Student Name',
					field:'studentName',
					align: 'center',
					valign: 'middle',
                    formatter: function (value, row, index) {
                        return '<a href="javascript:;" style="color: red;" onclick="detail(\''+row.studentId+'\')">'+row.studentName+'</a>';
                    }
				}];
				$('#_table').bootstrapTable({
					url:baseUrl+'/leaveRequests/list2?submissionTime='+submissionTime+'&teacherId='+teacherId,
					'method': "GET",
					locale: 'zh-CN',
					detailView: false,
					sidePagination: "server", //服务端处理分页
					striped: true,//隔行变色
					undefinedText: "",
					pagination: true,
					singleSelect: false,
					pageSize: pageList[0],
					cache: false, //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
					pageNumber: 1,
					pageList: pageList,
					search: false, //不显示 搜索框
					uniqueId: "uniqueId", //每一行的唯一标识，一般为主键列
					showColumns: false, //不显示下拉框（选择显示的列）
					undefinedText: '',
					columns: col,
					queryParams: function(params) {
						return {
							pageNum: this.pageNumber,
							pageSize: this.pageSize,
							sortOrder: params.order
						}
					},
					
				});
			});
			var callback_save=function(){
				return $('.layui-form').serialize();
			}
			function bindFormData(){
				if(uid){
					$.ajax({
						url:baseUrl+'/leaveRequests/'+uid,
						type:'get',
						success:function(data){
							$.link(true, ".kit-table", data.data);
							$('select').select2().change();
						},
						error:function(){
							parent.layer.alert('系统或网络错误！');
						}
					});
				}
			}
            var detail = function(uid) {
                parent.layer.open({
                    //				title: false,
                    maxmin: true,
                    type: 2,
                    area: modalArea,
                    content: './views/form/StudentsDetail.html?studentId='+uid, //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
                    btn: [ '关闭'],
                    btn2: function(index, layero) {
                    }
                });
            }
		</script>
	</body>

</html>
